<template>
  这是钉钉回调页面
</template>

<script setup>
  import { ref, onMounted } from "vue"
  import {useRoute, useRouter } from "vue-router";
  import http from "../http"

  const route = useRoute()
  const router = useRouter()

  let authcode = route.query.authCode

  let types = route.query.types

  onMounted(() => {
    http.get(`user/dingtalkcallback/?authCode=${authcode}&types=${types}`)
    .then(res=>{
      console.log(res)
      if(res.data.msg == "登录成功"){
        router.push('/homepage')
      }
    })
    .catch(error=>{
      console.log(error)
    })
  })
</script>